package com.webguard.outlierdetection.mapper;


import com.webguard.outlierdetection.pojo.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {
    @Select("select * from user where username = #{username}")
    User findByUserName(String username);

    @Insert("insert into user(username,password,create_time,update_time,email,is_admin) values(#{username},#{password},now(),now(),#{email},false)")
    void addUser(String username,String password,String email);

    @Update("update user set username = #{username},email = #{email},update_time= #{updateTime} where id = #{id}")
    void update(User user);


    @Update("update user set password = #{newPassword} where id = #{id}")
    void updatePwd(String newPassword, Integer id);

    @Select("select * from user where email = #{email}")
    User findByEmail(String email);

    @Select("select * from user where id = #{id}")
    User findById(String id);
}
